package com.tjeasyshare.controller;


import com.tjeasyshare.data.model.User;
import com.tjeasyshare.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;

/**
 * Created by Administrator on 2016/6/7.
 */

@Controller
public class HomeController {

    @Autowired
    private UserService userService;

    @RequestMapping("/home")
    public String home(Model model) {
        model.addAttribute("message", "hello, world");
        //return "WEB-INF/views/home.jsp";
        return "home";
    }

    @RequestMapping(value = "/shop",method = RequestMethod.GET)
    public @ResponseBody User getShopInJSON() {


        User user=new User();
        user.setId(3);
        user.setNickname("33");
        user.setState(1);
        userService.insertUser(user);
        return user;

    }


}
